//
//  CategoryTableViewCell.m
//  陶瓷
//
//  Created by 王戈 on 15/6/6.
//  Copyright (c) 2015年 王戈. All rights reserved.
//

#import "CategoryTableViewCell.h"
#import "BrowseCountBtn.h"

@interface CategoryTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *categoryImageView;
@property (weak, nonatomic) IBOutlet UIImageView *adImageView;
@property (weak, nonatomic) IBOutlet UILabel *adLabel;
@property (weak, nonatomic) IBOutlet UIButton *hearBtn;
@property (weak, nonatomic) IBOutlet BrowseCountBtn *brosewCountView;




@end


@implementation CategoryTableViewCell

+ (instancetype)cellWithTableView:(UITableView *)tableView {
    static NSString *identifier = @"CategoryTableViewCell";
    // 1.取缓存中取
    CategoryTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    // 2.创建cell
    if (cell == nil) {
        cell =  [[[NSBundle mainBundle] loadNibNamed:@"CategoryTableViewCell" owner:nil options:nil] firstObject];
    }
    return cell;
}

- (IBAction)heartBtnClick:(UIButton *)sender {
    
    
}

- (void)setCompany:(CompanyModel *)company {
    
    _adLabel.text = company.Brand ? company.Brand : company.Title ;
    NSURL *imageURL = company.HeadImageUrl ? [NSURL URLWithString:company.HeadImageUrl] : [NSURL URLWithString:company.ImageUrl];
    _brosewCountView.count = company.BrowseNumber;
    
    [_categoryImageView sd_setImageWithURL:imageURL placeholderImage:nil];
}

@end
